package com.turing.post.salesmanage.util;

import java.math.BigInteger;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;

import com.turing.post.cardmanagement.util.CardFace;
import com.turing.post.util.PCPSApplicationException;
import com.turing.post.util.PCPSWebInput;

/**
 * 销售单业务接口
 * 
 * @author zxp
 * @Dec 23, 2012
 */
@Remote
@Local
public interface SaleOrderBusiness {

	/**
	 * 打包上送销售单
	 * 
	 * @param webInput
	 * @param saleOrderIds
	 * @throws PCPSApplicationException
	 */
	public void updateSaleOrderActivateBranchNo(PCPSWebInput webInput,
			BigInteger[] saleOrderIds, BigInteger bankAccDetailId)
			throws PCPSApplicationException;

	/**
	 * 售卡时检查卡是否可卖，获取卡面信息
	 * 
	 * @param webInput
	 * @param socd
	 * @return CardFace 备注中为当前卡批次剩余库存
	 * @throws PCPSApplicationException
	 */
	public CardFace getSaleOrderCardFace(PCPSWebInput webInput,
			SaleOrderCardDetail socd) throws PCPSApplicationException;

	/**
	 * 创建销售单录入全部参数
	 * 
	 * @param webInput
	 * @param saleOrder
	 * @param cardDetailList
	 * @param salesDetailList
	 * @param realNameList
	 * @param paidDetailList
	 * @return
	 * @throws PCPSApplicationException
	 */
	public SaleOrder createSaleOrder(PCPSWebInput webInput,
			SaleOrder saleOrder, List<SaleOrderCardDetail> cardDetailList,
			List<SaleOrderSalesDetail> salesDetailList,
			List<SaleOrderRealNameDetail> realNameList,
			List<SaleOrderPaidDetail> paidDetailList)
			throws PCPSApplicationException;

	/**
	 * 撤销销售单
	 * 
	 * @param webInput
	 * @param saleOrder
	 * @return
	 * @throws PCPSApplicationException
	 */
	public SaleOrder cancelSaleOrder(PCPSWebInput webInput, SaleOrder saleOrder)
			throws PCPSApplicationException;

	/**
	 * 销售单主管授权
	 * 
	 * @param webInput
	 * @param autherName
	 * @param autherPass
	 * @return 返回BigInteger.ZERO,授权失败
	 * @throws PCPSApplicationException
	 */
	public BigInteger authCreateSaleOrder(PCPSWebInput webInput,
			String autherName, String autherPass)
			throws PCPSApplicationException;

	/**
	 * 上载持卡人实名信息excel
	 * 
	 * @param webInput
	 *            日志记录对象
	 * @param saleOrderId
	 *            销售单编号
	 * @param file
	 *            实名文件
	 */
	public void importSaleOrderRealNameDetailExcelFile(PCPSWebInput webInput,
			BigInteger saleOrderId, byte[] file)
			throws PCPSApplicationException;

	/**
	 * 批量导入excel到实名表中
	 * 
	 * @param webInput
	 *            日志记录对象
	 * @param saleOrderId
	 *            销售单编号
	 */
	public void importExcelFileToSaleOrderRealNameDetail(PCPSWebInput webInput,
			BigInteger saleOrderId) throws PCPSApplicationException;

	/**
	 * 打印销售单时凭证出库
	 * 
	 * @param webInput
	 * @param saleOrderId
	 * @param voucherId
	 * @param voucherNo
	 * @throws PCPSApplicationException
	 */
	public void updateSaleOrderVoucherNo(PCPSWebInput webInput,
			BigInteger saleOrderId, String voucherNo)
			throws PCPSApplicationException;

	/**
	 * 判断销售单付款是否包含现金
	 * 
	 * @param saleOrders
	 * @return
	 */
	public boolean checkCashSaleOrder(BigInteger[] saleOrders);

	/**
	 * 销售单审核卡
	 * 
	 * @param webInput
	 * @param saleOrderIds
	 * @param status
	 * @throws PCPSApplicationException
	 */
	public void authSaleOrderCard(PCPSWebInput webInput,
			BigInteger[] saleOrderIds) throws PCPSApplicationException;

	/**
	 * 销售单资金审核
	 * 
	 * @param webInput
	 * @param saleOrderIds
	 * @throws PCPSApplicationException
	 */
	public void authSaleOrderMoney(PCPSWebInput webInput,
			BigInteger[] saleOrderIds) throws PCPSApplicationException;

	/**
	 * 单个销售单资金审核
	 * @param webInput
	 * @param saleOrderId
	 * @throws PCPSApplicationException
	 */
	public void authOneSaleOrderMoney(PCPSWebInput webInput,
			BigInteger saleOrderId) throws PCPSApplicationException;

	/**
	 * 销售单授信付款补录
	 * 
	 * @param webInput
	 * @param sopd
	 * @throws PCPSApplicationException
	 */
	public void paySaleOrderCredit(PCPSWebInput webInput,
			SaleOrderPaidDetail sopd) throws PCPSApplicationException;

	/**
	 * 销售单授信付款撤销
	 * 
	 * @param webInput
	 * @param sopd
	 * @throws PCPSApplicationException
	 */
	public void cancelSaleOrderCredit(PCPSWebInput webInput,
			SaleOrderPaidDetail sopd) throws PCPSApplicationException;
}
